package com.ss.summer.entity;


import com.ss.summer.entity.enums.SummerInstanceStatus;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Map;

/**
 * <p>
 * 审核实例
 * </p>
 *
 * @author xia17
 * @since 2019-07-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SummerInstance implements Serializable {

private static final long serialVersionUID=1L;

    public SummerInstance(){}


    private Long id;

    /**
     * 审批例子id
     */
    private Long flowId;

    /**
     * 应用申请id
     */
    private String applyId;

    /**
     * 当前节点id
     */
    private Long nowNode;

    /**
     * 结果
     */
    private SummerInstanceStatus status;

    /**
     * 当前状态(显示节点信息)
     */
    private String nowStatus;

    /**
     * 提交人选定的节点
     */
    private Integer submitNode;

    /**
     * 关联查询
     */
    private SummerNode node;

    public SummerInstance(Map<String,Object> map){
        if (map == null){
            return;
        }
        this.id = (Long) map.get("id");
        this.flowId = (Long) map.get("flow_id");
        this.applyId = (String) map.get("apply_id");
        Object nowNode = map.get("now_node");
        if (nowNode != null){
            this.nowNode = (Long) nowNode;
        }
        this.status = SummerInstanceStatus.valueOf((Integer) map.get("status"));
        this.nowStatus = (String) map.get("now_status");
        Object submitNode = map.get("submitNode");
        if (submitNode != null){
            this.submitNode = (Integer) submitNode;
        }
    }

}
